/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package towerdefense.model;

import java.awt.Dimension;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import towerdefense.data.Tower;

/**
 *
 * @author Flo
 */
public class TowerSelection extends javax.swing.JPanel {

    /**
     * Creates new form TowerSelection
     */
    private List<Tower> towerselectionlist = new ArrayList<>();

    public TowerSelection(int x, int y, int tilesize) {
        initComponents();
        initTowers();
        Dimension d = new Dimension(x * tilesize, 100);
        this.setSize(d);
        this.setPreferredSize(d);
        this.setMinimumSize(d);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

    private void initTowers() {
        try {
            towerselectionlist.add(new Tower(2, 10, 10, 2, "Fast Tower"));
            towerselectionlist.add(new Tower(2, 20, 10, 4, "Strong Tower"));
            towerselectionlist.add(new Tower(2, 20, 20, 2, "Fast and Strong Tower"));
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage() + "\n" + ex.getLocalizedMessage());
        }
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        for (Tower t : towerselectionlist) {
            //g.drawImage(, WIDTH, WIDTH, this);
        }

    }
}
